// index.js
// 获取应用实例
const app = getApp()
let fontSize=app.fontSize
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    avatarUrl:'/pages/image/nologin.png',
    userName:"未知用户",
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    canIUseGetUserProfile: false,
    canIUseOpenData:"",
    guanzhu:"0",
    fans:"0"
  },

  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
  },
  getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息，开发者每次通过该接口获取用户个人信息均需用户确认，开发者妥善保管用户快速填写的头像昵称，避免重复弹窗
    wx.getUserProfile({
      desc: '展示用户信息', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
      success: (res) => {
        console.log(res)
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true,
          avatarUrl:res.userInfo.avatarUrl,
          guanzhu:666,
          fans:899,
          canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
        })
      }
    })
  },
  tobangding:function(){
    wx.navigateTo({
      url: '/pages/bangding/bangding',
    })
  },
  tochange:function(){
    wx.navigateTo({
      url: '/pages/change/change',
    })
  },
  tofabu:function(){
    wx.navigateTo({
      url: '/pages/fabu/fabu',
    })
  },
  tosetting:function(){
    wx.navigateTo({
      url: '/pages/setting/setting',
    })
  }
})
